<template>
    <div class="wrapBox">
        <!-- 加号旋转变关闭按钮 -->
        <i class="bi bi-plus-lg fs-3 panelIcon" @click.stop="data.show = !data.show"
            :class="data.show == true ? 'showIcon' : ''"></i>
        <!-- 菜单按钮 -->
        <div class="panelBox" :class="data.show == true == true ? 'panelBoxActive' : ''"
            v-for="(item) in data.menueList">
            <i class="bi text-center text-sm menuIcon " :class="item.icon" @click="handel(item.path)"></i>
        </div>
    </div>
</template>

<script setup lang="ts">
import { reactive, } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const data = reactive({
    show: false,
    menueList: [
        { lable: '添加资源', icon: 'bi-box-seam', path: '/form/addResources' },
        { lable: '添加BUG', icon: 'bi-bug', path: '/form/addBug' },
        { lable: '优化建议', icon: 'bi-chat-left-heart', path: '/form/addOpinion' },
        { lable: '联系作者', icon: 'bi-flower1', path: '/form/addBug' },
        { lable: '联系作者', icon: 'bi-back', path: '/form/addBug' },
        { lable: '联系作者', icon: 'bi-bell', path: '/form/addBug' },
    ]
})
const handel = (val: any) => {
    data.show = false
    router.push({ path: val })
}
</script>
<style scoped lang='scss'>
.wrapBox {
    // 基于视窗定位
    position: fixed;
    right: 120px;
    bottom: 120px;

    //加号按钮触发添加
    .showIcon {
        transform: rotate(45deg);
    }

    .panelIcon {
        position: absolute;
        background: #ff9900;
        height: 60px;
        width: 60px;
        line-height: 60px;
        text-align: center;
        border-radius: 50%;
        color: white;
        transition: all 0.5s;
        z-index: 2022;
    }



    .panelBox {
        text-align: center;
        position: absolute;
        border-radius: 50%;
        height: 60px;
        width: 60px;
        transition: all .5s;

        .menuIcon {
            position: absolute;
            left: 10px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            height: 40px;
            width: 40px;
            padding: 5px;
            top: -50px;
            opacity: 0;
            z-index: 2023;
            cursor: pointer;
            white-space: nowrap;
            border-radius: 50%;
            background: #ff9900;
            color: white;
            transition: all .3s;

            &:hover {
                scale: 1.2;
            }
        }

    }
}

.panelBoxActive {

    &:nth-child(2) {
        transform: rotate(45deg);
        transition: all .5s;

        .menuIcon {
            transform: rotate(-45deg);
            opacity: 1;
        }
    }

    &:nth-child(3) {
        transform: rotate(90deg);
        transition: all .5s;

        .menuIcon {
            transform: rotate(-90deg);
            opacity: 1;
        }

    }

    &:nth-child(4) {
        transform: rotate(135deg);
        opacity: 1;
        transition: all .5s;

        .menuIcon {
            transform: rotate(-135deg);
            opacity: 1;
        }


    }

    &:nth-child(5) {
        transform: rotate(180deg);
        opacity: 1;
        transition: all .5s;

        .menuIcon {
            transform: rotate(180deg);
            opacity: 1;
        }
    }

    &:nth-child(6) {
        transform: rotate(225deg);
        opacity: 1;
        transition: all .5s;

        .menuIcon {
            transform: rotate(225deg);
            opacity: 1;
        }
    }

    &:nth-child(7) {
        transform: rotate(270deg);
        opacity: 1;
        transition: all .5s;

        .menuIcon {
            transform: rotate(deg);
            opacity: 1;
        }
    }

    &:nth-child(8) {
        transform: rotate(315deg);
        opacity: 1;
        transition: all .5s;

        .menuIcon {
            transform: rotate(180deg);
            opacity: 1;
        }
    }
}
</style>